package labox.innovation.gameserver.model;

import java.util.HashMap;
import java.util.Map;

public class ConsignmentCache {
	/**
	 * 角色id
	 */
	public static Long ownerid;
	
	/**
	 * 分类查找
	 */
	public static final int CATEGORY=0; 
	
	/**
	 * 当前要查找是第几页
	 */
	private int currentPage=1;
	/**
	 * 查找方式
	 */
	private int searchType;
	/**
	 * 查找的条件
	 */
	private int[] searchCondition; 
	/**
	 * 每页对应的页面数据
	 */
	
	private  Map<Integer, Page> pageData=new HashMap<Integer, Page>();
	
	/**
	 * 是否是最后一页
	 */
	private boolean isLastPage=false;
	
	public boolean isLastPage() {
		return isLastPage;
	}

	public void setLastPage(boolean isLastPage) {
		this.isLastPage = isLastPage;
	}

	public Map<Integer, Page> getPageData() {
		return pageData;
	}

	public int getCurrentPage() {
		return currentPage;
	}

	public int getSearchType() {
		return searchType;
	}

	public int[] getSearchCondition() {
		return searchCondition;
	}


	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public void setSearchType(int searchType) {
		this.searchType = searchType;
	}
	public static Long getOwnerid() {
		return ownerid;
	}

	public static void setOwnerid(Long ownerid) {
		ConsignmentCache.ownerid = ownerid;
	}
	/**
	 * 重置数据
	 */
	public void reset(){
		currentPage=1;
		searchType=0;
		searchCondition=null;
		isLastPage=false;
		pageData.clear();
	}
	
	/**
	 * @param type
	 * @param condition
	 * 初始化查找条件
	 */
	public void init(int type,int[] condition){
		if(condition==null)
			return;
		searchType=type;
		searchCondition=condition;
		Page page=new Page(0, 0);
		pageData.put(1, page);
	}
	public void setSearchCondition(int[] searchCondition) {
		this.searchCondition = searchCondition;
	}
	
	public static class Page{
		/**
		 * 开始的索引
		 */
		public int startIndex;
		/**
		 * 结束的索引
		 */
		public int endIndex;
		Page(int start,int end){
			startIndex=start;
			endIndex=end;
		}
		
	}
}
